<template>
    <div>
        <button @click="xxx = 2">监听</button>
    </div>
</template>
<script>
export default {
    data() {
        return {
            xxx: 1,
        }
    },
    watch: {
        xxx(newVal, oldVal) {
            console.log('xxx的值发生了变化', '新的值为：' + newVal, '旧的值为：' + oldVal)
        }
    },
}

</script>